import { createSlice } from "@reduxjs/toolkit"

export const userSlice = createSlice({
    name: "user",
    initialState: {
      id: null,
      name: null,
      realname: null
    },
    reducers: {
      changeUserId(state, action) {
        state.id = action.payload
      },
      changeUsername(state, action) {
        state.name = action.payload
      },
      changeRealName(state, action) {
        state.realname = action.payload
      }
    }
})

export const { changeUserId, changeUsername, changeRealName } = userSlice.actions

export default userSlice.reducer
